import {debounce} from 'common/utils'

import BackTop from 'components/content/backTop/BackTop'


export const itemListenerMixin={
    data(){
        return{
            itemImgListener:null
        }
    },
    mounted(){
        let refresh = debounce(this.$refs.scroll.refresh,100)

        this.itemImgListener=()=>{
            refresh();
        }
        this.$bus.$on('itemImgLoad', this.itemImgListener);
    }
}

export const backTopMixin={
    components:{
        BackTop
    },
    data(){
        return{
            isShow:false,
        }
    },
    methods:{
        backClick(){
        //    this.$refs.scroll是获得scroll组件对象
            this.$refs.scroll.scrollTo(0,0,1000);
        },
        listenShowBackTop(position){
            this.isShow=(-position.y)>1000;
        },
    }
}













